//
//  homeTableViewController.swift
//  Art
//
//  Created by mac on 2018/12/14.
//  Copyright © 2018 mac. All rights reserved.
//

import UIKit
import Alamofire

class homeTableViewController: UITableViewController {
        
    override func viewDidLoad() {
        super.viewDidLoad()

        tableView.separatorStyle = .none
        tableView.register(UINib(nibName: "imageTableViewCell", bundle: nil), forCellReuseIdentifier: "cell")
        
    }

    // MARK: - Table view data source

    override func numberOfSections(in tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return 2
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! imageTableViewCell


        return cell
    }
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        requestData()
    }

    func requestData() {
//        let parameters:Dictionary = ["authorId":"100190","page":"1",]
        let parameters:Dictionary = ["page":"1","userId":"109106"]

        Alamofire.request("http://api.pmkoo.cn/aiss/suite/suiteList.do", method:.post,parameters: parameters)
            .responseString { response in
                
                print("result==\(response.result)")   // 返回结果，是否成功
                if let jsonValue = response.result.value {
                    print("result==\(jsonValue)")   // 返回结果，是否成功
                    let gpData = Entity()
                    gpData.gpName = ""
                    
                }
        }
        
        
        
    }

    func requestData2() {
        let parameters:Dictionary = ["suiteId":"2769","token":"fa5e2c0b90064de194c5e3b317d75021","userId":"109106"]
        
        Alamofire.request("http://api.pmkoo.cn/aiss/order/userHaveOrder.do",method:.post, parameters: parameters)
            .responseString { response in
                
                print("result==\(response.result)")   // 返回结果，是否成功
                if let jsonValue = response.result.value {
                    print("result==\(jsonValue)")   // 返回结果，是否成功
                    let gpData = Entity()
                    gpData.gpName = ""
                    
                }
        }
        
        
        
    }
    
}
